<?php
	class CommentModel extends Model{
		public $_validate =	array(
				array('manner',array(-1,0,1),'请确保输入合法!',Model::MUST_VALIDATE,'in'),
				array('content','require','评论内容必须填写！'),
		);
		
		public $_auto =	array(
				array('date','time',self::MODEL_INSERT,'function'),
				array('state','getState',Model:: MODEL_INSERT,'callback'),
				array('uid','checkUid',Model::MODEL_INSERT,'callback'),
		);
		
		//自动填充审核状态state未0，未审核
		public function getState(){
			return 0;
		}
		
		//检测uid，如果uid为空，则填充0，表示是游客评论
		public function checkUid(){
			return empty($_POST['uid']) ? 0 : $_POST['uid'];
		}
	}

?>